# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  
  def view_reservation(reservation)
    post = reservation.post
    member = reservation.member
    html = reservation.start_date.strftime('%H:%M')
    html << ' <span>to</span> '
    html << reservation.user_end_date.strftime('%H:%M')
    html << ' <span class="ressource">'
    html << link_to(post.title, post_path(post))
    html << '</span> <span>by '
    html << link_to(member.login, member_path(member)) if member
    html << ' '
    html << link_to('<img src="/images/calendar_edit.png" alt="Edit This Booking" class="editbutton" />', reservation_path(reservation), {:title => "Edit This Booking"})
    html << '</span>'
  end
  
  def station_time_select(field, decal=false)
    %{<select id="#{field}_hour" name="#{field}[hour]">
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11" #{'selected="selected"' if decal}>11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    </select>
     : <select id="#{field}_min" name="#{field}[min]">
    <option value="00">00</option>
    <option value="30">30</option>
    </select>}
  end
end
